package com.jiyi.activity.datainput.sm;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.swift.base.ActivityBase;
import com.swift.maintenance.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Administrator on 2018/3/22.
 */

public class BuildSpaceSafeActivity extends ActivityBase {
    /* 头部 */
    @BindView(R.id.tvBack)
    TextView tvBack;
    @BindView(R.id.tvTitle)
    TextView tvTitle;
    @BindView(R.id.tvSearch)
    TextView tvSearch;


    String build_id;
    //1 读  2 写
    int type = 2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_build_space_safe);
        ButterKnife.bind(this);
        init();
    }

    public void init() {
        getIntentData();
        setTop();
    }

    public void getIntentData() {
        build_id = getIntent().getStringExtra("build_no");
        if (TextUtils.isEmpty(build_id))
            build_id = "";
        type = getIntent().getIntExtra("type", 1);

    }

    private void setTop() {
        tvTitle.setText("建筑场所消防安全条件");
        tvSearch.setVisibility(View.GONE);
    }

    @OnClick({R.id.tvBack, R.id.tvSearch, R.id.cvFireSpace, R.id.cvFireZone, R.id.cvSafeEvacuation, R.id.cvEquipIsOk, R.id.cvFireCase})
    public void onClick(View view) {
        Intent intent;
        switch (view.getId()) {
            case R.id.tvBack:
                finish();
                break;
            case R.id.cvFireSpace:
                //消防车道与消防扑救场地
                if (type == 1) {
                    intent = new Intent(this, FireSpaceReadActivity.class);
                } else {
                    intent = new Intent(this, FireSpaceActivity.class);
                }

                intent.putExtra("build_no", build_id);
                startActivity(intent);
                break;
            case R.id.cvFireZone:
                //防火分区与平面布置
                if (type == 1) {
                    intent = new Intent(this, FireZoneReadActivity.class);
                } else {
                    intent = new Intent(this, FireZoneActivity.class);
                }

                intent.putExtra("build_no", build_id);
                startActivity(intent);
                break;
            case R.id.cvSafeEvacuation:
                //安全疏散与避难
                if (type == 1) {
                    intent = new Intent(this, SafeEvacuationReadActivity.class);

                } else {
                    intent = new Intent(this, SafeEvacuationActivity.class);
                }

                intent.putExtra("build_no", build_id);
                startActivity(intent);
                break;
            case R.id.cvEquipIsOk:
                //消防设施设备是否完好有效
                if (type == 1) {
                    intent = new Intent(this, FireEquipReadActivity.class);

                } else {
                    intent = new Intent(this, FireEquipActivity.class);
                }

                intent.putExtra("build_no", build_id);
                startActivity(intent);
                break;
            case R.id.cvFireCase:
                //专项防火情况
                if (type == 1) {
                    intent = new Intent(this, SpecialFirePreventionReadActivity.class);

                } else {
                    intent = new Intent(this, SpecialFirePreventionActivity.class);
                }

                intent.putExtra("build_no", build_id);
                startActivity(intent);
                break;
            default:
                break;
        }
    }
}
